
static const k_sensor_reg ov5647_mipi2lane_1080p_30fps_linear[] = {
    //pixel_rate = 81666700
    {0x0103, 0x01},
    {0x0100, 0x00},
    {0x3034, 0x1a},
    {0x3035, 0x21},
    {0x3036, 0x62},	//PLL multiplier
    {0x303c, 0x11},	//plls_sys_div
    {0x3106, 0xf5},	//PLL clock divider
    {0x3821, 0x02},	//verticall, bit1: flip, bit0: bining
    {0x3820, 0x00},	//horizontal, bit1: mirror, bit0: bining
    {0x3827, 0xec},
    {0x370c, 0x03},
    {0x3612, 0x5b},
    {0x3618, 0x04},
    {0x5000, 0x06},	//blc enable
    {0x5001, 0x00},	// set awb disble
	{0x5002, 0x00},	//disable win, otp and awb gain
    {0x5003, 0x08},
    {0x5a00, 0x08},
    {0x3000, 0x00},
    {0x3001, 0x00},
    {0x3002, 0x00},
    {0x3016, 0x08},
    {0x3017, 0xe0},
    {0x3018, 0x44},	//2 lane, MIPI
    {0x301c, 0xf8},
    {0x301d, 0xf0},
    {0x3a18, 0x03},	//gain_celling, max gain value 
    {0x3a19, 0xff},		//gain_celling
    {0x3c01, 0x80},
    {0x3b07, 0x0c},
    {0x380c, 0x08},         // HTS = 2271
    {0x380d, 0xdf},         //
    {0x380e, 0x04},         //VTS = 1199
    {0x380f, 0xaf},         //
	{0x3814, 0x11},	//horizontal subsampling
	{0x3815, 0x11},	//vertical subsampling
    {0x3708, 0x64},
    {0x3709, 0x12},
    {0x3808, 0x07},	// x output size: 1920
    {0x3809, 0x80},
    {0x380a, 0x04},	// y output size: 1080
    {0x380b, 0x38},
    {0x3800, 0x01},	//x start = 0x15c = 348
    {0x3801, 0x5c},
    {0x3802, 0x01},	//y start = 0x1b2 = 434
    {0x3803, 0xb2},
    {0x3804, 0x08},	//x end = 0x8e3 = 2275, x size = 2275 - 348 +1 = 1928
    {0x3805, 0xe3},
    {0x3806, 0x05},	//y end = 0x5f1 = 1521, y size = 1521 - 434 + 1 = 1088
    {0x3807, 0xf1},
	{0x3811, 0x04},	//x offset: 4
	{0x3813, 0x02},	//y offset: 2
    {0x3630, 0x2e},
    {0x3632, 0xe2},
    {0x3633, 0x23},
    {0x3634, 0x44},
    {0x3636, 0x06},
    {0x3620, 0x64},
    {0x3621, 0xe0},
    {0x3600, 0x37},
    {0x3704, 0xa0},
    {0x3703, 0x5a},
    {0x3715, 0x78},
    {0x3717, 0x01},
    {0x3731, 0x02},
    {0x370b, 0x60},
    {0x3705, 0x1a},
    {0x3f05, 0x02},
    {0x3f06, 0x10},
    {0x3f01, 0x0a},
    {0x3a00, 0x00},	//AEC control, all disable
    {0x3a08, 0x01},	//50Hz step
    {0x3a09, 0x4b},
    {0x3a0a, 0x01},	//60Hz step
    {0x3a0b, 0x13},
    {0x3a0d, 0x04},
    {0x3a0e, 0x03},
    {0x3a0f, 0x58},
    {0x3a10, 0x50},
    {0x3a1b, 0x58},
    {0x3a1e, 0x50},
    {0x3a11, 0x60},
    {0x3a1f, 0x28},
    {0x4001, 0x02},
    {0x4004, 0x04},	//blc line number
    {0x4000, 0x09},
    {0x4837, 0x19},
    {0x4800, 0x34},
    {0x3501, 0x02},	//ET = 42 lines
    {0x3502, 0xa0},
    {0x3503, 0x07},         //0x0f
    {0x350b, 0x10},         // gain
    // {0x0100, 0x01},
    {REG_NULL, 0x00},
};


static const k_sensor_reg  ov5647_2592x1944_10bpp[] = {
    //pixel_rate = 87500000
    {0x0100, 0x00},
    {0x0103, 0x01},
    {0x3034, 0x1a},
    {0x3035, 0x21},
    {0x3036, 0x69},
    {0x303c, 0x11},
    {0x3106, 0xf5},
    {0x3821, 0x02},  //0x00
    {0x3820, 0x00},
    {0x3827, 0xec},
    {0x370c, 0x03},
    {0x3612, 0x5b},
    {0x3618, 0x04},
    {0x5000, 0x06},
    {0x5001, 0x00},         // set awb disble
    {0x5002, 0x00},
    {0x5003, 0x08},
    {0x5a00, 0x08},
    {0x3000, 0x00},
    {0x3001, 0x00},
    {0x3002, 0x00},
    {0x3016, 0x08},
    {0x3017, 0xe0},
    {0x3018, 0x44},
    {0x301c, 0xf8},
    {0x301d, 0xf0},
    {0x3a18, 0x03},
    {0x3a19, 0xff},
    {0x3c01, 0x80},
    {0x3b07, 0x0c},
    {0x380c, 0x0b},
    {0x380d, 0x1c},
    {0x380e, 0x08},
    {0x380f, 0x03},
    {0x3814, 0x11},
    {0x3815, 0x11},
    {0x3708, 0x64},
    {0x3709, 0x12},
    {0x3808, 0x0a},
    {0x3809, 0x20},
    {0x380a, 0x07},
    {0x380b, 0x98},
    {0x3800, 0x00},
    {0x3801, 0x00},
    {0x3802, 0x00},
    {0x3803, 0x00},
    {0x3804, 0x0a},
    {0x3805, 0x3f},
    {0x3806, 0x07},
    {0x3807, 0xa3},
    {0x3811, 0x10},
    {0x3813, 0x06},
    {0x3630, 0x2e},
    {0x3632, 0xe2},
    {0x3633, 0x23},
    {0x3634, 0x44},
    {0x3636, 0x06},
    {0x3620, 0x64},
    {0x3621, 0xe0},
    {0x3600, 0x37},
    {0x3704, 0xa0},
    {0x3703, 0x5a},
    {0x3715, 0x78},
    {0x3717, 0x01},
    {0x3731, 0x02},
    {0x370b, 0x60},
    {0x3705, 0x1a},
    {0x3f05, 0x02},
    {0x3f06, 0x10},
    {0x3f01, 0x0a},
    {0x3a00, 0x00},
    {0x3a08, 0x01},
    {0x3a09, 0x28},
    {0x3a0a, 0x00},
    {0x3a0b, 0xf6},
    {0x3a0d, 0x08},
    {0x3a0e, 0x06},
    {0x3a0f, 0x58},
    {0x3a10, 0x50},
    {0x3a1b, 0x58},
    {0x3a1e, 0x50},
    {0x3a11, 0x60},
    {0x3a1f, 0x28},
    {0x4001, 0x02},
    {0x4004, 0x04},
    {0x4000, 0x09},
    {0x4837, 0x19},
    {0x4800, 0x34}, //0x24},
    {0x3503, 0x07},         //0x0f
    {0x350b, 0x10},         // gain
    {0x0100, 0x01},
    {REG_NULL, 0x00},
};

//90 fps ok
static const k_sensor_reg ov5647_640x480_10bpp[] = {
   //pixel_rate = 92.5 MHz, 1792 x 573 x 90fps
    {0x0103, 0x01},
    {0x0100, 0x00},
    {0x3034, 0x1a},
    {0x3035, 0x21},
    {0x3036, 0x6f},
    {0x303c, 0x11},
    {0x3106, 0xf5},
	{0x3820, 0x01},	//horizontal, bit1: mirror, bit0: bining
	{0x3821, 0x03},	//verticall, bit1: flip, bit0: bining
    {0x3827, 0xec},
    {0x370c, 0x03},
    {0x3612, 0x59},
    {0x3618, 0x00},
    {0x5000, 0x06},
    {0x5001, 0x00}, 	// set awb disble
    {0x5002, 0x00},	//disable win, otp and awb gain
    {0x5003, 0x08},
    {0x5a00, 0x08},
    {0x3000, 0x00},
    {0x3001, 0x00},
    {0x3002, 0x00},
    {0x3016, 0x08},
    {0x3017, 0xe0},
    {0x3018, 0x44},	//2 lane, MIPI
    {0x301c, 0xf8},
    {0x301d, 0xf0},
    {0x3a18, 0x03},	//gain_celling, max gain value
    {0x3a19, 0xff},		//gain_celling
    {0x3c01, 0x80},
    {0x3b07, 0x0c},
    {0x380c, 0x07},	// HTS = 1792
    {0x380d, 0x00},
    {0x380e, 0x02},	//VTS = 573
    {0x380f, 0xF0}, // 0x3D
    {0x3814, 0x35},	//horizontal subsampling, 8/2
    {0x3815, 0x35},	//vertical subsampling, 8/2
    {0x3708, 0x64},
    {0x3709, 0x52},
    {0x3808, 0x02},	// x output size: 640
    {0x3809, 0x80},
    {0x380a, 0x01},	// y output size: 480
    {0x380b, 0xe0},
	{0x3800, 0x00},     // x start 24
	{0x3801, 0x18},
	{0x3802, 0x00},     // y start 12
	{0x3803, 0x0c}, 
	{0x3804, 0x0a},     //x end = 0xa1f = 2607, x size = 2607 +1 - 24 = 2584 (648 x 2 + 640 x 2 + 8)
	{0x3805, 0x2f},
	{0x3806, 0x07},     //y end = 0x7a3 = 1955, y size = 1955 +1 - 12 = 1944(486 x 4)
	{0x3807, 0xa3},
	{0x3811, 0x04},	//x offset: 4
	{0x3813, 0x02},	//y offset: 2
    {0x3630, 0x2e},
    {0x3632, 0xe2},
    {0x3633, 0x23},
    {0x3634, 0x44},
    {0x3636, 0x06},
    {0x3620, 0x64},
    {0x3621, 0xe0},
    {0x3600, 0x37},
    {0x3704, 0xa0},
    {0x3703, 0x5a},
    {0x3715, 0x78},
    {0x3717, 0x01},
    {0x3731, 0x02},
    {0x370b, 0x60},
    {0x3705, 0x1a},
    {0x3f05, 0x02},
    {0x3f06, 0x10},
    {0x3f01, 0x0a},
    {0x3a00, 0x00},	//AEC control, all disable
    {0x3a08, 0x01},	//50Hz step
    {0x3a09, 0x2e},
    {0x3a0a, 0x00},	//60Hz step
    {0x3a0b, 0xfb},
    {0x3a0d, 0x02},
    {0x3a0e, 0x01},
    {0x3a0f, 0x58},
    {0x3a10, 0x50},
    {0x3a1b, 0x58},
    {0x3a1e, 0x50},
    {0x3a11, 0x60},
    {0x3a1f, 0x28},
    {0x4001, 0x02},
    {0x4004, 0x02},	//blc line number
    {0x4000, 0x09},
    //{0x4837, 0x15},
    {0x4800, 0x34},
    {0x3501, 0x02},	//ET = 42 lines
    {0x3502, 0xa0},
    {0x3503, 0x07},         //0x0f
    {0x350b, 0x10},         // gain
    {0x0100, 0x01},
    {REG_NULL, 0x00},
};

static const k_sensor_reg ov5647_mipi2lane_1080p_30fps_flip_linear[] = {
    //pixel_rate = 81666700
    {0x0103, 0x01},
    {0x0100, 0x00},
    {0x3034, 0x1a},
    {0x3035, 0x21},
    {0x3036, 0x62},	//PLL multiplier
    {0x303c, 0x11},	//plls_sys_div
    {0x3106, 0xf5},	//PLL clock divider
    {0x3821, 0x00},	//verticall, bit1: flip, bit0: bining
    {0x3820, 0x02},	//horizontal, bit1: mirror, bit0: bining
    {0x3827, 0xec},
    {0x370c, 0x03},
    {0x3612, 0x5b},
    {0x3618, 0x04},
    {0x5000, 0x06},	//blc enable
    {0x5001, 0x00},	// set awb disble
	{0x5002, 0x00},	//disable win, otp and awb gain
    {0x5003, 0x08},
    {0x5a00, 0x08},
    {0x3000, 0x00},
    {0x3001, 0x00},
    {0x3002, 0x00},
    {0x3016, 0x08},
    {0x3017, 0xe0},
    {0x3018, 0x44},	//2 lane, MIPI
    {0x301c, 0xf8},
    {0x301d, 0xf0},
    {0x3a18, 0x03},	//gain_celling, max gain value 
    {0x3a19, 0xff},		//gain_celling
    {0x3c01, 0x80},
    {0x3b07, 0x0c},
    {0x380c, 0x08},         // HTS = 2271
    {0x380d, 0xdf},         //
    {0x380e, 0x04},         //VTS = 1199
    {0x380f, 0xaf},         //
	{0x3814, 0x11},	//horizontal subsampling
	{0x3815, 0x11},	//vertical subsampling
    {0x3708, 0x64},
    {0x3709, 0x12},
    {0x3808, 0x07},	// x output size: 1920
    {0x3809, 0x80},
    {0x380a, 0x04},	// y output size: 1080
    {0x380b, 0x38},
    {0x3800, 0x01},	//x start = 0x15c = 348
    {0x3801, 0x5c},
    {0x3802, 0x01},	//y start = 0x1b2 = 434
    {0x3803, 0xb2},
    {0x3804, 0x08},	//x end = 0x8e3 = 2275, x size = 2275 - 348 +1 = 1928
    {0x3805, 0xe3},
    {0x3806, 0x05},	//y end = 0x5f1 = 1521, y size = 1521 - 434 + 1 = 1088
    {0x3807, 0xf1},
	{0x3811, 0x04},	//x offset: 4
	{0x3813, 0x02},	//y offset: 2
    {0x3630, 0x2e},
    {0x3632, 0xe2},
    {0x3633, 0x23},
    {0x3634, 0x44},
    {0x3636, 0x06},
    {0x3620, 0x64},
    {0x3621, 0xe0},
    {0x3600, 0x37},
    {0x3704, 0xa0},
    {0x3703, 0x5a},
    {0x3715, 0x78},
    {0x3717, 0x01},
    {0x3731, 0x02},
    {0x370b, 0x60},
    {0x3705, 0x1a},
    {0x3f05, 0x02},
    {0x3f06, 0x10},
    {0x3f01, 0x0a},
    {0x3a00, 0x00},	//AEC control, all disable
    {0x3a08, 0x01},	//50Hz step
    {0x3a09, 0x4b},
    {0x3a0a, 0x01},	//60Hz step
    {0x3a0b, 0x13},
    {0x3a0d, 0x04},
    {0x3a0e, 0x03},
    {0x3a0f, 0x58},
    {0x3a10, 0x50},
    {0x3a1b, 0x58},
    {0x3a1e, 0x50},
    {0x3a11, 0x60},
    {0x3a1f, 0x28},
    {0x4001, 0x02},
    {0x4004, 0x04},	//blc line number
    {0x4000, 0x09},
    {0x4837, 0x19},
    {0x4800, 0x34},
    {0x3501, 0x02},	//ET = 42 lines
    {0x3502, 0xa0},
    {0x3503, 0x07},         //0x0f
    {0x350b, 0x10},         // gain
    //{0x0100, 0x01},
    {REG_NULL, 0x00},
};

// 60 fps  binning ok
static const k_sensor_reg mode_1280x720_60fps[] = {
	//PCLK = 91666667 Hz, 1796 x 851 x 60
    {0x0100, 0x00},
	{0x0103, 0x01},
	{0x3034, 0x1a},
    {0x3035, 0x21},
    {0x3036, 0x6e},	//PLL multiplier
	{0x303c, 0x11},
	{0x3106, 0xf5},
	{0x3820, 0x01},	//horizontal, bit1: mirror, bit0: bining
	{0x3821, 0x03},	//verticall, bit1: flip, bit0: bining
	{0x3827, 0xec},
	{0x370c, 0x03},
	{0x3612, 0x59},
	{0x3618, 0x00},
	{0x5000, 0x06},	//blc enable
    {0x5001, 0x00},	// set awb disble
	{0x5002, 0x00},	//disable win, otp and awb gain
	{0x5003, 0x08},
	{0x5a00, 0x08},
	{0x3000, 0x00},
	{0x3001, 0x00},
	{0x3002, 0x00},
	{0x3016, 0x08},
	{0x3017, 0xe0},
	{0x3018, 0x44},	//2 lane, MIPI
	{0x301c, 0xf8},
	{0x301d, 0xf0},
    {0x3a18, 0x03},	//gain_celling, max gain value 
    {0x3a19, 0xff},		//gain_celling
	{0x3c01, 0x80},
	{0x3b07, 0x0c},
	{0x380c, 0x07},     //  HTS=  1796 = 0x704
	{0x380d, 0x04},     
    {0x380e, 0x03},     //  VTS=  0x032c = 851
	{0x380f, 0x53},
	{0x3814, 0x31},
	{0x3815, 0x31},
	{0x3808, 0x05},     // x output size: 1280,   1280 * 2 = 2,560
	{0x3809, 0x00},    
	{0x380a, 0x02},     // y output size: 720,   720 * 2 = 1,440
	{0x380b, 0xd0},
    {0x3800, 0x00},     // x start = 24
	{0x3801, 0x18},
	{0x3802, 0x00},     // y start = 252
	{0x3803, 0xfc},
	{0x3804, 0x0a},     // x end = 0x0a27 + 1 = 2576 + 24, x size = 1288 x 2 = 2576
	{0x3805, 0x27},     
	{0x3806, 0x06},     // y end = 0x6a7 +1 = 1452 + 252, y size = 726 x 2 = 1452
	{0x3807, 0xa7}, 
	{0x3811, 0x04},	//x offset: 4
	{0x3813, 0x02},	//y offset: 2

	{0x3630, 0x2e},
	{0x3632, 0xe2},
	{0x3633, 0x23},
	{0x3634, 0x44},
	{0x3636, 0x06},
	{0x3620, 0x64},
	{0x3621, 0xe0},
	{0x3600, 0x37},
	{0x3704, 0xa0},
	{0x3703, 0x5a},
	{0x3715, 0x78},
	{0x3717, 0x01},
	{0x3731, 0x02},
	{0x370b, 0x60},
	{0x3705, 0x1a},
	{0x3f05, 0x02},
	{0x3f06, 0x10},
	{0x3f01, 0x0a},
    {0x3a00, 0x00},	//AEC control, all disable
	{0x3a08, 0x01},
	{0x3a09, 0x28},
	{0x3a0a, 0x00},
	{0x3a0b, 0xf6},
	{0x3a0d, 0x08},
	{0x3a0e, 0x06},
	{0x3a0f, 0x58},
	{0x3a10, 0x50},
	{0x3a1b, 0x58},
	{0x3a1e, 0x50},
	{0x3a11, 0x60},
	{0x3a1f, 0x28},
	{0x4001, 0x02},
	{0x4004, 0x04},	//blc line number
	{0x4000, 0x09},
	{0x4837, 0x16},
	{0x4800, 0x24},

    {0x3501, 0x02},	//ET = 42 lines
    {0x3502, 0xa0},
    {0x3503, 0x07},         //0x03
	{0x350b, 0x10},
	{0x3212, 0xa0},
	{0x0100, 0x01},
    {REG_NULL, 0x00},
};

// 960p45 10bpp
static const k_sensor_reg ov5647_1280x960p45_10bpp[] = {
    //PCLK = 88333333 Hz, 1796 x 1093 x 45fps
    {0x0100, 0x00},
	{0x0103, 0x01},
	{0x3034, 0x1a},
	{0x3035, 0x21},
	{0x3036, 0x6a},	//PLL multiplier
	{0x303c, 0x11},
	{0x3106, 0xf5},
	{0x3820, 0x01},	//horizontal, bit1: mirror, bit0: bining
	{0x3821, 0x03},	//verticall, bit1: flip, bit0: bining
	{0x3827, 0xec},
	{0x370c, 0x03},
	{0x3612, 0x59},
	{0x3618, 0x00},
	{0x5000, 0x06},	//blc enable
    {0x5001, 0x00},	//set awb disble
	{0x5002, 0x00},	//disable win, otp and awb gain
	{0x5003, 0x08},
	{0x5a00, 0x08},
	{0x3000, 0x00},
	{0x3001, 0x00},
	{0x3002, 0x00},
	{0x3016, 0x08},
	{0x3017, 0xe0},
	{0x3018, 0x44},	//2 lane, MIPI
	{0x301c, 0xf8},
	{0x301d, 0xf0},
    {0x3a18, 0x03},	//gain_celling, max gain value 
    {0x3a19, 0xff},		//gain_celling
	{0x3c01, 0x80},
	{0x3b07, 0x0c},
	{0x380c, 0x07},     // HTS = 0x768 = 1796 
	{0x380d, 0x04},
    {0x380e, 0x04},     // VTS = 0x7b0 = 1093
	{0x380f, 0x45},
	{0x3814, 0x31},
	{0x3815, 0x31},
	{0x3808, 0x05},     // x output size = 1280, 1280 x 2 = 2560
	{0x3809, 0x00},
	{0x380a, 0x03},     // y output size = 960, 960 x 2 = 1920
	{0x380b, 0xc0},
	{0x3800, 0x00},     // x start 24
	{0x3801, 0x18},
	{0x3802, 0x00},     // y start 12
	{0x3803, 0x0c}, 
	{0x3804, 0x0a},     // x end = 0xa27 +1 = 2600, x size = 2600 - 24 = 1288 x 2 = 2576
	{0x3805, 0x27},
	{0x3806, 0x07},     // y end = 0x797+1 = 1944, y size = 1944 - 12 = 966 x 2 = 1932
	{0x3807, 0x97},
	{0x3811, 0x04},	//x offset: 4
	{0x3813, 0x02},	//y offset: 2

	{0x3630, 0x2e},
	{0x3632, 0xe2},
	{0x3633, 0x23},
	{0x3634, 0x44},
	{0x3636, 0x06},
	{0x3620, 0x64},
	{0x3621, 0xe0},
	{0x3600, 0x37},
	{0x3704, 0xa0},
	{0x3703, 0x5a},
	{0x3715, 0x78},
	{0x3717, 0x01},
	{0x3731, 0x02},
	{0x370b, 0x60},
	{0x3705, 0x1a},
	{0x3f05, 0x02},
	{0x3f06, 0x10},
	{0x3f01, 0x0a},
    {0x3a00, 0x00},	//AEC control, all disable
	{0x3a08, 0x01},
	{0x3a09, 0x28},
	{0x3a0a, 0x00},
	{0x3a0b, 0xf6},
	{0x3a0d, 0x08},
	{0x3a0e, 0x06},
	{0x3a0f, 0x58},
	{0x3a10, 0x50},
	{0x3a1b, 0x58},
	{0x3a1e, 0x50},
	{0x3a11, 0x60},
	{0x3a1f, 0x28},
	{0x4001, 0x02},
	{0x4004, 0x04},	//blc line number
	{0x4000, 0x09},
	{0x4837, 0x16},
	{0x4800, 0x24},

    {0x3501, 0x02},	//ET = 42 lines
    {0x3502, 0xa0},
	{0x3503, 0x07},
	{0x350b, 0x10},
	{0x3212, 0xa0},
	{0x0100, 0x01},
    {REG_NULL, 0x00},
};
